from django.db import models

class City(models.Model):
    name = models.CharField('城市名称', max_length=55, default='')
    travel_total = models.CharField('景点个数', max_length=55, default='')
    create_time = models.DateTimeField('创建时间', auto_now_add=True)


class Travel(models.Model):
    name = models.CharField('景点名称', max_length=255, default='')
    city = models.ForeignKey(City, on_delete=models.CASCADE)
    price = models.FloatField('门票价格', default='')
    star = models.CharField('等级', max_length=255, default='')
    address = models.CharField('景点地址', max_length=255, default='')
    detail_url = models.CharField('详情地址', max_length=255, default='')
    comment_total = models.IntegerField('评论个数', default=0)
    detail_intro = models.TextField('详情介绍', default='')
    short_intro = models.TextField('短评', default='')
    img_list = models.TextField('图片列表', default='')
    cover = models.CharField('封面', max_length=255, default='')
    sale_count = models.IntegerField('销售额', default='')
    districts = models.CharField('地区', max_length=255, default='')
    score = models.FloatField('评分', default=0)
    create_time = models.DateTimeField('爬取时间', auto_now_add=True)


class Comments(models.Model):
    travel = models.ForeignKey(Travel, on_delete=models.CASCADE)
    content = models.TextField('内容', default='')
    date = models.DateTimeField('评论时间')
